<template>
  <div>
    <ul class="mui-table-view mui-table-view-chevron">
				<li class="mui-table-view-cell mui-media" v-for="item in newslist" :key="item.id">
					<router-link :to="'/home/newsinfo/'+item.id" class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" :src="item.images">
						<div class="mui-media-body">
							<h1>{{ item.title }}</h1>
							<p class="mui-ellipsis">
                <span>发表时间：{{ item.addtime | dateFormat }}</span>
                <span>浏览次数：{{ item.click }}</span>
              </p>
						</div>
					</router-link>
				</li>
			</ul>
  </div>
</template>

<script>
import { Toast } from 'mint-ui'

export default {
  data: () => {
    return {
      newslist: []
    }
  },
  methods: {
    getNewsList() {
      this.$http.get("news?_start=1&_limit=10").then(result => {
        this.newslist = result.body
      }, error => {
        Toast('获取新闻列表失败！')
      })
    }
  },
  created() {
    this.getNewsList()
  }
}
</script>

<style lang="scss" scoped>
  .mui-media-body{
    h1{
      font-size: 17px;
    }
    .mui-ellipsis{
      span{
        font-size: 12px;
      }
    }
  }
</style>
